package com.seed.core.configuration.relation;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.seed.core.pojo.seed.HasManys;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class HasManyConfiguration extends HasOneConfiguration {
    protected Integer limit = 5;

    public HasManys toHasMany() {
        HasManys ret = new HasManys();
        ret.setTargetSeedName(seedName);
        ret.setLabel(label);
        ret.setComment(comment);
        ret.setSelfColumn(selfColumn);
        ret.setTargetColumn(targetColumn);
        ret.setCascade(cascade);
        ret.setExtra(extra);
        ret.setLimit(limit);

        return ret;
    }

    public HasManyConfiguration toFront() {
        HasManyConfiguration ret = new HasManyConfiguration();
        ret.setSeedName(seedName);
        ret.setLabel(label);
        ret.setComment(comment);
        ret.setExtra(extra);
        ret.setLimit(limit);

        return ret;
    }

    public Integer getLimit() {
        return limit;
    }

    public void setLimit(Integer limit) {
        this.limit = limit;
    }
}
